package io.yizoo.business.controller;

import io.yizoo.business.entity.biz_cmis_order;
import io.elm.core.CoreController;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.EnumSet;
import java.util.List;

@RestController
@RequestMapping("/business/cmis/order")
public class cmis_orderController extends CoreController {

    @Override
    protected void Init() {
        PowerEntity = biz_cmis_order.class;
        PowerUse = EnumSet.of(Power.IDDelete, Power.IDAny, Power.IDGetSingle,Power.IDUpsert);
    }

    @PostMapping("/GetData")
    public Object GetData(@RequestBody String jsonStr) {
        List<?> ret = Ctor.CoreMapper.USelect(
                Ctor.DMaker(jsonStr).Selector
                        .From(biz_cmis_order.class)
                        .IsWhere("and order_name like concat('%', #{order_name}, '%')", "order_name")
                        .OrderBy("order_date desc")
                        .IsPage()
                        .GetFactor());
        return JsonResultPage(ret);
    }

}
